#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
const ll N = 2e5 + 10;
ll l[N], r[N];
void solve()
{
    ll n, m;
    cin >> n >> m;
    ll ans = 0, cnt = 0;
    vector<ll> a(n + 1);
    for (ll i = 1; i <= n;i++)
    {
        cin >> a[i];
        if(a[i]==0)
            cnt++;
        if(a[i]<0)
        {
            l[-a[i]]++;
        }
        if(a[i]>0)
        {
            r[a[i]]++;
        }
    }
    // for(auto ch:a)
    // {
    //     cout << ch << " ";
    // }
    // cout << endl;
    for (ll i = 1; i <= m;i++)
    {
        l[i] += l[i - 1];
        r[i] += r[i - 1];
    }

    for (ll i = 0; i <= m;i++)
    {
        ll t = l[i];
        if(m-2*i>0)
        {
            t = t + r[m - 2 * i];
        }
        ans = max(t, ans);

        t = r[i];
        if (m - 2 * i > 0)
        {
            t = t + l[m - 2 * i];
        }
        ans = max(ans, t);
    }
    cout << ans+cnt << endl;
}
int main()
{
    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
